<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="/style/public.css"/>
    <style>
        body{
            background: url("/imgs/bg.png") center center;
        }
        .main{
            width: 400px;
            height: 360px;
            margin:190px auto;
            background: white;
            border-radius: 8px;
            box-sizing: border-box;
            padding: 20px 40px;
        }
        .main h2{
            text-align: center;
            color: rgb(77,172,214);
        }
        .main ul{
            margin-top: 20px;
        }
        .main li{
            margin-top: 18px;
        }
        .main li input{
            width: 100%;
            margin-top: 5px;
            height: 32px;
            box-sizing: border-box;
            padding-left: 24px;

            border: 1px solid #cccccc;
        }
        .main li:last-child input{
            width: 114px;
            float: left;
            margin-top: 0;
        }
        .div{
            overflow: hidden;
            margin-top: 5px;
            cursor: pointer;
        }
        .div span{
            color: white;
        }
        .main li span{
            display: block;
            background: rgb(0,174,214);
            float: right;
            height: 32px;
            line-height: 32px;
            padding: 0 20px;
            border-radius: 4px;
        }
        .goIndex{
            margin-top: 20px;
            float: right;
            cursor: pointer;
        }
        .mumber{
            background: url("/imgs/mumber.png") no-repeat 4px 6px;
            background-size: 16px 16px;
        }
        .password{
            background: url("/imgs/key.png") no-repeat 4px 6px;
            background-size: 16px 16px;
        }
        .yanzhengma{
            background: url("/imgs/yzn.png") no-repeat 4px 7px;
            background-size: 16px 16px;
        }
        .main li:last-child input {



        }
    </style>
</head>
<body>
   <div class="main" style="width: 400px;
    height: 400px;
    margin: 190px auto;
    background: white;
    border-radius: 8px;
    box-sizing: border-box;
    padding: 10px 40px;">
        <h2>品牌代理系统</h2>
       <ul>
           <li>
               <p>用户名</p>
               <input class="mumber" type="text"/>
           </li>
           <li>
               <p>密码</p>
               <input class="password" type="password"/>
           </li>
           <li>
               <p>验证码</p>
               <div  class="div">
               <input  class="yanzhengma"  style="width: 114px;float: left;margin-top: 0;" type="text"/>&nbsp;&nbsp;
               <img  src="{{url('center/code')}}" alt="验证码" onclick="this.src='{{url('center/code')}}?'+new Date().getTime();" >
               </div>
           </li>
           <li>
               <span  id="SubLogin" style="float: left;cursor: pointer;">确认登陆</span>
               <span style="float: right;cursor: pointer;" onclick="window.location.href='{{urlAdmin('Login','getRegister')}}'">注册品牌</span>
           </li>
       </ul>

   </div>
</body>
</html>
<script src="/js/jquery-1.8.3.min.js"></script>
<script src="/static/js/layer/layer.js"></script>

<script>
     var SubLogin = document.getElementById('SubLogin');
     var input = document.getElementsByClassName('main')[0].getElementsByTagName("input");

     SubLogin.onclick = function(){
         if(input[0].value=='' || input[1].value==''){
             layer.msg('用户信息不能为空', {icon: 6});
               return ;
         }

         $.ajax({
             type:"POST",
             url:"/logindo",
             data:{
                 username:input[0].value,
                 password:input[1].value,
                 code: input[2].value
             },
             dataType:"json",
             success:function(res){
                 if(res['status']==1){
                     if(res['type']==1) {
                         window.location.href = '/center/brand/apply?status=0';
                     }else{
                         window.location.href = '/center/agentlev'
                     }
                 }else{
                     layer.msg(res['msg'], {icon: 6});
                 }
             }
         })

     }
</script>